/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86184
 * Date: 2023-01-26
 * Time: 12:43
 */
public class java_operator {

    public static void main(String[] args) {
        //取余运算
        //被除数是正数，余数就为正数   被除数为负数，余数就为负数
        System.out.println(10%3);  //1
        System.out.println(-10%3);  //-1
        System.out.println(10%-3);  //1
        System.out.println(-10%-3);  //-1
    }

    public static void main2(String[] args) {

        //强转运算

        System.out.println(5/2);  //2
        System.out.println(5/2.0);  //2.5
        System.out.println(5.0/2);  //2.5
        System.out.println((float)5/2);  //2.5
        System.out.println(5/(float)2);  //2.5
        System.out.println((float)(5/2));  //2.0
    }
    public static void main1(String[] args) {
        //基本运算
        int a = 20;
        int b = 10;

        System.out.println(a + b); // 30
        System.out.println(a - b); // 10
        System.out.println(a * b); // 200
        System.out.println(a / b); // 2
        System.out.println(a % b); // 0
    }

}
